package model

import (
	"time"
)

const GROUP_USER_ROLE_IS_OWNER byte = 0
const GROUP_USER_ROLE_IS_ADMIN byte = 1
const GROUP_USER_ROLE_IS_MEMBER byte = 2

type GroupsUsers struct {
	AppsId  uint      `json:"apps_id" xorm:"not null unique(apps_groupid_userId) comment('app id') INT"`
	GroupId int64    `json:"group_id" xorm:"BIGINT notnull unique(apps_groupid_userId) comment('群组id')"`
	UserId     int64    `json:"userId" xorm:"BIGINT notnull unique(apps_groupid_userId) comment('用户id')"`
	Role    byte      `json:"role" xorm:"TINYINT notnull default 2 comment('角色 0:拥有者 1:管理员 2:成员')"`
	Status  int8      `json:"status" xorm:"TINYINT notnull default 1 comment('状态 -1:软删 0:待审核 1:正常')"`
	joined  time.Time `json:"joined" xorm:"TIMESTAMP"`
	created time.Time `json:"created" xorm:"created TIMESTAMP not null"`
}

func (uc GroupsUsers) TableName() string {
	return "groups_users"
}

type Groups struct {
	Id   int64  `json:"id"`
	Name string `json:"name"`
	Desc string `json:"desc"`
}
